package com.baize.channel.game.util;

import android.content.res.AssetManager;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

public class AppConfig {

    public static String appid ;

    public static String appkey;

    public static String gameUrl;

    public static void init(AssetManager assetManager){
        gameUrl(assetManager);
    }


    private static void gameUrl(AssetManager assetManager){
        InputStream reader = null;
        InputStreamReader inputStreamReader = null;
        BufferedReader bufferedReader = null;
        try {
            reader = assetManager.open("bzyouxiprovider");
            inputStreamReader = new InputStreamReader(reader);
            bufferedReader = new BufferedReader(inputStreamReader);
            String str = bufferedReader.readLine();
            str = CryptUtil.decode(str);
            String[] ary =  str.split("\\|");
            gameUrl =ary[2];
            appid =ary[0];
            appkey =ary[1];
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                if(reader != null){
                    reader.close();
                }
                if(inputStreamReader != null){
                    inputStreamReader.close();
                }
                if(bufferedReader != null){
                    bufferedReader.close();
                }
            }catch (Exception exception){

            }
        }

    }
}
